package com.study.chain.auth.builderchain;

import com.study.chain.auth.Member;

public class ValidateHandler extends Handler {
    @Override
    protected void doHandler(Member member) {
        Member m = checkExists(member.getLoginName(),member.getLoginPass());
        if(null == m){
            System.out.println("用户不存在");
            return;
        }
        System.out.println("登录成功！");
        if(this.nextHandler != null){
            this.nextHandler.doHandler(m);
        }
    }

    private Member checkExists(String loginName,String loginPass){
        Member member = new Member(loginName,loginPass);
        member.setRoleName("管理员");
        return member;
    }
}
